raar.process
Class RAActor

java.lang.Object
  extended byraar.process.RAProcess
      extended byraar.process.RAActor
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
RAAngleActor, RASpeedActor, RATraceActor

public abstract class RAActor
extends RAProcess

RAActor is a process with only one RAReal input. Mind the fact that an RAActor does not have any registers! Most methods are therefore emulated and will work as expected. Class is abstract because implemented actors must take care that only valid values are set. Do this by implementing the isInputValid method.

In this version, the Java null is supported as input. It will result in a zero value (since zero means no action).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class raar.process.RAProcess
hasRun, inregister, outregister, register, sourceCode, statement
 
Constructor Summary
RAActor(java.lang.String inputName)
          Construct an RAActor with given input name.
 
Method Summary
 void dumpRegisters()
          Give a System.out dump of the current content.
 void execute()
          Executing an actor is not allowed and will throw an exception.
 RADataType get(java.lang.String key)
          Get a specific key's value from the output register.
 RAReal getActorValue()
          Returns the RAReal currently stored in the actor (the actor value).
 RADataType getDataType(java.lang.String name)
          Returns the datatype for a given name.
abstract  java.lang.String getDescription()
          Describe the actor.
 java.util.Vector getInputNames()
          Get a String vector containing the names of the keys the input register stores (in order).
 java.util.Vector getInputObjects()
          Get an RADataType vector containing the current content of the input register.
 java.util.Vector getOutputNames()
          Get a String vector containing the names of the keys the output register stores (in order).
 java.util.Vector getOutputObjects()
          Get an RADataType vector containing the current content of the output register.
abstract  boolean isInputValid(RADataType value)
          Implement this method to make the actor only respond to valid values.
 void run()
          Run the actor; for compatibility with other processes you can use this method, however it does not actually do anything.
 void set(java.lang.String key, RADataType value)
          Set a specific key in the input register to a specific value.
 void setActorValue(RAReal value)
          Set the actor value directly.
 void setSourceCode(java.lang.String code)
          Setting the process source code is illegal and will do nothing.
 
Methods inherited from class raar.process.RAProcess
acceptsInput, clone, getProcessName, getSourceCode, isSpecial, reset, setProcessName, suppliesOutput
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RAActor

public RAActor(java.lang.String inputName)
Construct an RAActor with given input name.

Method Detail

setSourceCode

public void setSourceCode(java.lang.String code)
Setting the process source code is illegal and will do nothing.

Overrides:
setSourceCode in class RAProcess

execute

public void execute()
             throws RAException
Executing an actor is not allowed and will throw an exception.

Overrides:
execute in class RAProcess
Throws:
RAException

run

public void run()
         throws RAException
Run the actor; for compatibility with other processes you can use this method, however it does not actually do anything.

Overrides:
run in class RAProcess
Throws:
RAException

dumpRegisters

public void dumpRegisters()
Give a System.out dump of the current content.

Overrides:
dumpRegisters in class RAProcess

getDescription

public abstract java.lang.String getDescription()
Describe the actor.


set

public void set(java.lang.String key,
                RADataType value)
         throws RAException
Set a specific key in the input register to a specific value. Overridden; does work when you use the input name as your key. Will throw an exception otherwise (just as the normal processes).

Overrides:
set in class RAProcess
Throws:
RAException

isInputValid

public abstract boolean isInputValid(RADataType value)
Implement this method to make the actor only respond to valid values. Please mind you that the value 0 (for a Real) and "" (for a String) as well as the value NULL always has to be accepted!


get

public RADataType get(java.lang.String key)
               throws RAException
Get a specific key's value from the output register. Overridden; does work when you use the input name as your key. Will throw an exception otherwise (just as the normal processes).

Overrides:
get in class RAProcess
Throws:
RAException

getDataType

public RADataType getDataType(java.lang.String name)
                       throws RAException
Returns the datatype for a given name. Necessary for making healthy connections. All actors have a Real as their datatype and therefore will return Real.

Overrides:
getDataType in class RAProcess
Throws:
RAException

getInputNames

public java.util.Vector getInputNames()
Get a String vector containing the names of the keys the input register stores (in order). This shows a user which inputs a process has (by name).

Overrides:
getInputNames in class RAProcess

getInputObjects

public java.util.Vector getInputObjects()
Get an RADataType vector containing the current content of the input register. Rather than manipulating this content in a sneaky way now, you should use this feature to determine the datatypes of the content. This enables checking whether certain connections are allowed between (various) processes' out- and input.

Overrides:
getInputObjects in class RAProcess

getOutputNames

public java.util.Vector getOutputNames()
Get a String vector containing the names of the keys the output register stores (in order). This shows a user which outputs a process has (by name).

An Actor does not have any outputs and will return null.

Overrides:
getOutputNames in class RAProcess

getOutputObjects

public java.util.Vector getOutputObjects()
Get an RADataType vector containing the current content of the output register. Rather than manipulating this content in a sneaky way now, you should use this feature to determine the datatypes of the content. This enables checking whether certain connections are allowed between (various) processes' out- and input.

An Actor does not have any outputs and will return null.

Overrides:
getOutputObjects in class RAProcess

getActorValue

public RAReal getActorValue()
Returns the RAReal currently stored in the actor (the actor value).


setActorValue

public void setActorValue(RAReal value)
Set the actor value directly. Dirty.